import { ItemData } from "../../../resource/info/ItemData";
import { EBind } from "../../../../../Message/Public/EBind";
import { SmeltMaterialItemData } from "./SmeltMaterialItemData";
type int = number;
//class SmeltPlanData
    
    export  class SmeltPlanData
    {
        

        public get mainProduce(): ItemData
        {
            var loc1=0;
            if (!this._mainProduce) 
            {
                loc1 = parseInt(this.smeltMainProduce.split(",")[0]);
                this._mainProduce = new ItemData(loc1);
                if (this._mainProduce.itemInfo.item.bind == EBind._EBindYes && !(this._mainProduce.itemInfo.item.codeUnbind == 0)) 
                {
                    loc1 = this._mainProduce.itemInfo.item.codeUnbind;
                    this._mainProduce = new ItemData(loc1);
                }
                this._mainProduce.itemAmount = this.mainProduceAmount;
            }
            return this._mainProduce;
        }

        public get mainProduceAmount(): int
        {
            return parseInt(this.smeltMainProduce.split(",")[1]);
        }

        public set smeltPlanDesc(arg1: string)
        {
            if (arg1 == null) 
            {
                this._smeltPlanDesc = "";
            }
            else 
            {
                this._smeltPlanDesc = arg1.replace("{desc}", this.mainProduce.itemInfo.item.descStr);
            }
            return;
        }

        public get smeltPlanDesc(): string
        {
            return this._smeltPlanDesc;
        }

        public get mainProduceRate(): int
        {
            return parseInt(this.smeltMainProduce.split(",")[2]);
        }

        public get materials(): Array<any>
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=0;
            if (this._materials == null) 
            {
                this._materials = [];
                loc1 = this.smeltMaterialList.split("#");
                loc5 = 0;
                while (loc5 < loc1.length) 
                {
                    loc2 = loc1[loc5] as string;
                    if (!(loc2 == null) && !(loc2 == "")) 
                    {
                        loc3 = loc2.split(",");
                        (loc4 = new SmeltMaterialItemData(parseInt(loc3[0]))).itemAmountNeeded = parseInt(loc3[1]);
                        this._materials.push(loc4);
                    }
                    ++loc5;
                }
            }
            return this._materials;
        }

        public /* var */smeltPlanCode: int;

        public /* var */showLevel: int;

        public /* var */minLevel: int;

        public /* var */maxLevel: int;

        public /* var */defaultSmeltNum: int;

        public /* var */career: int;

        public /* var */smeltPlanCoin: int;

        /* internal */ /* var */_smeltPlanDesc: string;

        public /* var */smeltMainProduce: string;

        public /* var */smeltExtendProduce: string;

        public /* var */smeltMaterialList: string;

        public /* var */canSmeltNum: int;

        /* internal */ /* var */_mainProduce: ItemData;

        /* internal */ /* var */_materials: Array<any>;
    }
